package huawei.js2025;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 九宫格游戏
 */
public class Question25 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int[] nums = new int[9];
        for (int i = 0; i < 9; i++) {
            nums[i] = sc.nextInt();
        }
        int[] ints = new int[9];
        Set<Integer> set = new HashSet<>();
        fill(nums,0, ints, set);
    }

    public static void fill(int[] nums, int i, int[] ints, Set<Integer> set) {
        if (i == 9) {
            int v1 = ints[0] * ints[1] * ints[2];
            int v2 = ints[3] * ints[4] * ints[5];
            int v3 = ints[6] * ints[7] * ints[8];

            int v4 = ints[0] * ints[3] * ints[6];
            int v5 = ints[1] * ints[4] * ints[7];
            int v6 = ints[2] * ints[5] * ints[8];

            int v7 = ints[0] * ints[4] * ints[8];
            int v8 = ints[2] * ints[4] * ints[6];

            if (v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7 && v7 == v8) {
                System.out.println(ints[0] + " " + ints[1] + " " + ints[2] + " " + ints[3] + " " + ints[4] + " " + ints[5] + " " + ints[6] + " " + ints[7] +" " + ints[8]);
            }

            return;
        }

        for (int j = 0; j < 9; j++) {
            if (!set.contains(j)) {
                ints[i] = nums[j];
//                System.out.println(ints[0]);
                set.add(j);
                fill(nums, i + 1, ints, set);
                set.remove(j);
            }
        }
    }
}
